Skip to contentSkip to conversation

sqrt() function in xenomai kernel module

Xenomai-help Mathieu JOINIE-MAURIN 3 participants 3 messages Aug 29, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I need to use a sqrt() function in a kernel module code. I am a beginner with Xenomai. Is there any math_module which already exists ?

Thanks in advance,

Mathieu

      _____________________________________________________________________________ 

Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail

#1 lore raw
Quoted 3 lines · Mathieu JOINIE-MAURIN

Hi,

I need to use a sqrt() function in a kernel module code. I am a beginner with Xenomai. Is there any math_module which already exists ?

Counter question: Why do you need to use math in kernel code? It is generally a sign something is not well split-up between kernel-based driver code and user-space RT applications.

To answer your question: No, Xenomai does not come with a kernel math lib because there is not much use for it - generally. Porting the app to user-space is recommended.

Jan

#2 lore raw
In reply to Mathieu JOINIE-MAURIN
Quoted 7 lines · Mathieu JOINIE-MAURIN

Hi,

I need to use a sqrt() function in a kernel module code. I am a beginner with Xenomai. Is there any math_module which already exists ?

Thanks in advance,

There is no math module, if you really want to, you can port the libmath from a c library such as the glibc or uclibc, or newlib and make it a kernel module. If you do so, we willl be pleased to add this module to Xenomai.

Now, regarding the sqrt function, if what you want is the integer square root of an integer argument, you can use the int_sqrt function, declared in linux/kernel.h.

Signature · 1 line
                                               Gilles Chanteperdrix